from appium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
import os
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

os.system('adb root')
cap = {
  "platformName": "Android",
  "deviceName": "emulator-5554",
  "noReset": True,
  "appPackage": "com.kongfz.app",
  "appActivity": "com.kongfz.app/com.kongfz.app.home.mvvm.homepage.HomeActivity"
}
driver = webdriver.remote('http://127.0.0.1:4723/wd/hub', cap)
#轻敲
driver.tap([418,68],500)
sleep(3)
#滑动
driver.swipe(270,745,270,300,1000)
sleep(2)
driver.swipe(270,745,270,300,1000)
sleep(3)
#按键
driver.press_keycode(3)
sleep(2)
#截屏
driver.save_screenshot("tupian.png")
